package com.dingding.service.core.special.service.impl;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;

import com.dingding.common.core.beans.special.Specialuserlogin;
import com.dingding.common.core.util.ToolUtil;
import com.dingding.facade.user.common.dto.special.driver.ReqSpecialDriverId;
import com.dingding.facade.user.common.dto.special.driver.ResSpecialDriver;
import com.dingding.service.core.special.dao.ISpeicalDriverDao;
import com.dingding.service.core.special.service.ISpecialDriverService;

/**
 * 
 * @ClassName: SpeicalDriverServiceImpl 
 * @Description: 专车司机业务逻辑实现类
 * @author YHQ
 * @date 2016年12月5日 下午1:37:55
 * @since V2.5.7
 * 
 */
@Component("speicalDriverService")
public class SpecialDriverServiceImpl implements ISpecialDriverService{

	private Logger log = Logger.getLogger(this.getClass());
	
	@Resource(name = "speicalDriverDao")
	private ISpeicalDriverDao specialDriverDao;
	
	/**
	 * 
	 * @Title: getSpecialDriverId 
	 * @Description: 获取专车司机Id
	 * @param reqSpecialDriverId 获取专车司机请求Bean
	 * @author YHQ 
	 * @since V2.5.7
	 * @return ResSpecialDriverId    返回类型
	 * 
	 */
	@Override
	public ResSpecialDriver getSpecialDriverId(ReqSpecialDriverId reqSpecialDriverId) {
		
		// 判断客户端请求参数是否为空
		if(reqSpecialDriverId == null || ToolUtil.isBlank(reqSpecialDriverId.getTelPhone())){
			log.info("获取专车司机Id时请求参数为空");
			return null;
		}
		
		// 创建获取专车司机Id响应Bean对象
		ResSpecialDriver resSpecialDriverId = new ResSpecialDriver();
		
		// 获取专车司机登录信息
		Specialuserlogin specialuserlogin = specialDriverDao.getSpecialUserLogin(reqSpecialDriverId.getTelPhone());
		
		if(specialuserlogin != null){
			resSpecialDriverId.setSuid(specialuserlogin.getSuid());
		}
		
		return resSpecialDriverId;
	}

}
